Skip to content

release/1.1.1#22

Merged
Sean-mn merged 5 commits intomainfrom
release/1.1.1
Mar 12, 2026
Merged

release/1.1.1#22
Sean-mn merged 5 commits intomainfrom
release/1.1.1

Conversation

@Sean-mn
Copy link
Contributor

@Sean-mn Sean-mn commented Mar 12, 2026

📚작업 내용

  • CloseAsync: SELECT + SaveChanges 2번 왕복을 ExecuteUpdateAsync 1번으로 줄여 DB 왕복 최소화
  • JoinRoomUseCase: 전체 엔티티 UPDATE 방식을 IncrementPlayerCountAsync로 교체, current_players를 DB에서 원자적으로 증가시켜 동시 입장 경쟁 조건 해결
  • IncrementPlayerCountAsync 실패 시 방을 재조회해 실패 원인에 맞는 정확한 예외 반환 (방 없음 / 비활성 / 정원 초과 구분)
  • SteamAuthTicketValidator: ReadAsStringAsync + Deserialize 조합을 ReadFromJsonAsync 스트림 역직렬화로 교체해 중간 문자열 할당 제거
  • (status, created_at) 복합 인덱스 추가로 GET /api/v1/room/all 정렬 쿼리 최적화
  • EF Core 마이그레이션 히스토리 테이블을 room 스키마로 지정, 마이그레이션 dev/prod 적용 완료
  • JoinRoomUseCaseTests 경쟁 조건 케이스 3개 포함 테스트 보강

◀️참고 사항

IncrementPlayerCountAsyncWHERE current_players < max_players AND status = 'Active' 조건을 포함한 단일 UPDATE를 실행합니다. 0건 업데이트 시 방을 재조회해 실제 원인(방 소멸 / 상태 변경 / 정원 초과)을 구분합니다. 도메인의 room.Join() 호출은 빠른 실패를 위한 선행 검증으로 유지됩니다.

✅체크리스트

[ ]안에 x를 작성하면 체크박스를 체크할 수 있습니다.

  • 현재 의도하고자 하는 기능이 정상적으로 작동하나요?
  • 변경한 기능이 다른 기능을 깨뜨리지 않나요?

추후 필요한 체크리스트는 업데이트 될 예정입니다.

Sean-mn and others added 4 commits March 12, 2026 15:11
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
refactor: DB 쿼리 최적화 및 방 입장 동시성 개선
@gemini-code-assist
Copy link

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

이 Pull Request는 주로 방 관리 로직의 성능과 안정성을 향상시키는 데 중점을 둡니다. 데이터베이스 작업을 최적화하고, 동시성 문제를 해결하며, API 응답 속도를 개선하기 위한 변경 사항이 포함되어 있습니다. 특히, 방 입장 시 발생할 수 있는 경쟁 조건을 효과적으로 처리하고, 오류 발생 시 더 명확한 피드백을 제공하도록 시스템을 강화했습니다.

Highlights

  • DB 왕복 최소화: CloseAsync 메서드가 ExecuteUpdateAsync를 사용하여 DB 왕복 횟수를 최소화하도록 최적화되었습니다.
  • 동시성 경쟁 조건 해결: JoinRoomUseCase에서 방의 current_players를 원자적으로 증가시키고 동시성 문제를 해결하기 위해 전체 엔티티 업데이트 방식이 IncrementPlayerCountAsync로 대체되었습니다.
  • 정확한 예외 처리: IncrementPlayerCountAsync 실패 시, 방이 사라졌거나, 비활성화되었거나, 정원이 초과되었는지에 따라 정확한 예외를 반환하도록 오류 처리가 개선되었습니다.
  • 메모리 할당 최적화: SteamAuthTicketValidator에서 ReadAsStringAsyncDeserialize 조합이 ReadFromJsonAsync 스트림 역직렬화로 교체되어 중간 문자열 할당이 제거되었습니다.
  • 쿼리 성능 최적화: GET /api/v1/room/all 쿼리의 정렬 성능을 최적화하기 위해 (status, created_at) 복합 인덱스가 추가되었습니다.
  • EF Core 마이그레이션 스키마 지정: EF Core 마이그레이션 히스토리 테이블이 room 스키마로 지정되었으며, 개발 및 프로덕션 환경에 마이그레이션 적용이 완료되었습니다.
  • 테스트 범위 강화: JoinRoomUseCaseTests에 동시성 경쟁 조건에 대한 3가지 새로운 테스트 케이스가 추가되어 테스트 범위가 강화되었습니다.
Changelog
  • PushAndPull/Server/Application/Port/Output/Persistence/IRoomRepository.cs
    • UpdateAsync 메서드가 제거되고 IncrementPlayerCountAsync 메서드가 추가되었습니다.
  • PushAndPull/Server/Application/UseCase/Room/JoinRoomUseCase.cs
    • _roomRepository.UpdateAsync 호출이 _roomRepository.IncrementPlayerCountAsync 호출로 대체되었으며, 실패 시 방 상태에 따른 예외 처리 로직이 추가되었습니다.
  • PushAndPull/Server/Infrastructure/Auth/SteamAuthTicketValidator.cs
    • JSON 응답 역직렬화 방식이 ReadAsStringAsyncJsonSerializer.Deserialize에서 ReadFromJsonAsync로 변경되었습니다.
  • PushAndPull/Server/Infrastructure/Persistence/DbContext/AppDbContext.cs
    • Room 엔티티에 (Status, CreatedAt) 복합 인덱스가 추가되었습니다.
  • PushAndPull/Server/Infrastructure/Persistence/Repository/RoomRepository.cs
    • IncrementPlayerCountAsync 메서드가 ExecuteUpdateAsync를 사용하여 CurrentPlayers를 원자적으로 증가시키도록 구현되었습니다.
    • CloseAsync 메서드도 ExecuteUpdateAsync를 사용하여 방 상태와 만료 시간을 직접 업데이트하도록 변경되었습니다.
  • PushAndPull/Server/Migrations/20260312060119_AddRoomStatusCreatedAtIndex.Designer.cs
    • AddRoomStatusCreatedAtIndex 마이그레이션의 디자이너 파일이 생성되었습니다.
  • PushAndPull/Server/Migrations/20260312060119_AddRoomStatusCreatedAtIndex.cs
    • idx_room_status_created_at 인덱스를 생성하는 마이그레이션 로직이 추가되었습니다.
  • PushAndPull/Server/Migrations/AppDbContextModelSnapshot.cs
    • 데이터베이스 스키마 스냅샷이 업데이트되어 새로운 (Status, CreatedAt) 인덱스를 반영했습니다.
  • PushAndPull/Server/Program.cs
    • EF Core의 마이그레이션 히스토리 테이블이 room 스키마를 사용하도록 구성되었습니다.
  • PushAndPull/Tests/UseCase/Room/JoinRoomUseCaseTests.cs
    • 동시성으로 인해 방이 사라지거나, 비활성화되거나, 가득 찼을 때의 시나리오를 테스트하는 새로운 테스트 클래스 3개가 추가되었습니다.
    • 기존 테스트는 IncrementPlayerCountAsync 호출을 검증하도록 수정되었습니다.
Activity
  • 이 Pull Request에 대한 활동 내역은 제공되지 않았습니다.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

이번 릴리스에서는 데이터베이스 왕복 최소화, 동시성 문제 해결, 스트림 처리 개선 등 중요한 성능 및 안정성 향상이 이루어졌습니다. 전반적으로 훌륭한 변경 사항들입니다.

특히 JoinRoomUseCase에서 ExecuteUpdateAsync를 사용하여 경쟁 조건을 해결하고, 실패 시 원인을 정확히 파악하여 예외를 던지는 방식은 매우 인상적입니다. 또한 CloseAsyncSteamAuthTicketValidator의 최적화도 코드 품질을 높이는 데 크게 기여했습니다.

한 가지 유지보수성 측면에서 고려할 점을 RoomRepository.csCloseAsync 메서드에 댓글로 남겼습니다. 도메인 로직이 리포지토리에 복제되는 경우 발생할 수 있는 잠재적 문제를 다루고 있습니다. 확인 부탁드립니다.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Sean-mn Sean-mn merged commit ab2518f into main Mar 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant